package ptu.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import ptu.entity.Book;


import java.util.List;

@Mapper
public interface BookDao {

    @Select("select * from book")
    List<Book> selectAll();

    @Select("select * from book where b_name=#{bName}")
    Book selectByName(String bName);

    @Insert("insert into book values (DEFAULT,#{bName},#{bPrice},#{bTime},#{bSize},#{bAuthor},#{bPress})")
    int insert(Book book);

    int update(Book book);

    @Delete("delete from book where b_name=#{bName}")
    int delete(String bName);

    Book select(String work);


    List<Book> selectLike(Book book);

    @Select("select * from book where id=#{id}")
    Book getBookById(Integer id);
}
